#ifndef OBJ_CART_H
#define OBJ_CART_H

#include "obj.h"

#define CART_FRONT 0
#define CART_TRUCK 1

#define CART_NUM 2

#define CART_WIDTH 2.
#define CART_LENGHT 2.

//#define JOINT_STRENGHT 30

class obj_cart : public obj{
	public:
		obj_cart();
		virtual void load(){}

		int type;
		float mass;
		static int cloaded;	//class loaded
		static GLuint cart_textures[CART_NUM];
		
		virtual void update (float ,float );
		
		float cc_nx,cc_ny,cc_nl,cc_j,cc_e,cc_apx,cc_apy;
		int check_intersect(const point &,const point &, const point &); // usecky su 1.donekonecna_hore a 3.4.
		int check_intersect(const point &,const point &,const point &, const point &); // usecky su 1.2. a 3.4.
		int check_inside(const point &,const obj &);
		float check_plinedst(const point &a, const point &b, const point &c);
		int collide_my[4];
		vector <int> collide_his;
		int collision_my;	//kolko vrcholov ma v tom druhom
		int collision_his;
		int collision_normal; // 0 zo mna , 1 z neho 
		point collide_point;
		float closest_dst;
		point closest_points[2];
		void chcollide(obj &);
		void calc_collision(obj &, const point &, const point &, const point &);
		
		void chcollide_cart();
		
		float joint_fx,joint_fy,joint_rx,joint_ry,joint_x,joint_y;	//front, reer, temp
		void joint_push(obj_cart &);
		
		float ddrot,ddx,ddy; //tmp
		float vs,vk;		//rychlost v smere, rychlost kolma na smer (kolma dolava)
		void draw_cart();
		
		float weight;

};

#endif
